package com.jie.controller;

import com.jie.response.RespBean;
import com.jie.service.INoticeService;
import com.jie.vo.ConditionVO;
import com.jie.vo.NoticeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: 杰
 * @Project :net-disk
 * @DateTime: 2024/7/3 11:09
 **/
@RestController
@Api(tags = "通知模块")
@RequestMapping("/notify")
public class NotifyMessageController {

    @Autowired
    private INoticeService iNoticeService;
    @ApiOperation("添加通知")
    @PostMapping("")
    public  RespBean<?> addNotify(@RequestBody NoticeVO noticeVO){
        boolean flag=iNoticeService.addNotifyInfo(noticeVO);
        return RespBean.success("添加成功",flag);
    }
    @ApiOperation("发送通知")
    @PostMapping("/send/message")
    public RespBean<?> sendMessage(Integer noticeId){
        //业务逻辑
        boolean flag=iNoticeService.sendMessage(noticeId);
        return RespBean.success("发送成功",flag);
    }
    @ApiOperation("获取通知列表")
    @GetMapping("/get/NotifyList")
    public  RespBean<?> getNotifyList(ConditionVO conditionVO) {
        return RespBean.success("获取成功",iNoticeService.getNotifyList(conditionVO));
    }
    @ApiOperation("是否有未读通知")
    @GetMapping("/get/unread")
    public  RespBean<?> getUnreadNotify(){
        return RespBean.success("获取成功 各个通知条数：",iNoticeService.getUnreadNotify());
    }
}
